import Action

class BloodthirstyIdiot(object):
    def act(self, actor, battlespace):
        dist, closest = 100000, None
        for grunt in battlespace.grunts:
            if grunt.team != actor.team:
                d = grunt.coords.distanceTo(actor.coords) 
                if d < dist:
                    dist, closest = d, grunt
        if grunt:
            actor.action = Action.BasicAttack(closest)